home *** CD-ROM | disk | FTP | other *** search
- function gameStart()
- {
- cakeListing();
- pt.cakenum.gotoAndStop(ccnt + 1);
- var _loc1_ = 0;
- while(_loc1_ < itemnum)
- {
- cakeColor[_loc1_] = 0;
- cakeColor2[_loc1_] = 0;
- _loc1_ = _loc1_ + 1;
- }
- initSet();
- }
- function cakeCopy()
- {
- if(ccnt < itemnum)
- {
- _root.cakeMc.cake.duplicateMovieClip("cake" + copynum,copynum);
- _root.cakeMc["cake" + copynum]._alpha = 100;
- _root.cakeMc["cake" + copynum]._x = 0;
- _root.cakeMc["cake" + copynum]._y = 0;
- _root.cakeMc["cake" + copynum].gotoAndPlay("start");
- _root.cakeMc["cake" + copynum].cake.deco2._visible = false;
- _root.cakeMc["cake" + copynum].cake.deco3._visible = false;
- _root.cakeMc["cake" + copynum].cake.deco1.gotoAndStop(1);
- _root.cakeMc["cake" + copynum].cake.deco2.gotoAndStop(1);
- _root.cakeMc["cake" + copynum].cake.deco3.gotoAndStop(1);
- _root.cakeMc["cake" + copynum].coner = 0;
- _root.cakeMc["cake" + copynum].num = copynum;
- stepArr[copynum] = [];
- stepArr[copynum][0] = 1;
- _root.cakeMc["cake" + copynum].onEnterFrame = function()
- {
- if(this.coner == 0)
- {
- if(this._y >= 111)
- {
- this.coner = 1;
- this._y = 111;
- }
- else
- {
- this._y += 10;
- }
- }
- else if(this._y == 111 and this.coner == 1)
- {
- if(this._x >= 333)
- {
- this._x = 333;
- this.coner = 2;
- }
- else
- {
- this._x += cakesp;
- }
- }
- else if(this._x >= 333 and this.coner == 2)
- {
- if(this._x >= 426 and this._y >= 325)
- {
- this.coner = 3;
- this._x = 426;
- this._y = 325;
- }
- else
- {
- this._x += cakesp / 3;
- this._y += cakesp / 1.5;
- }
- }
- else if(this._x <= 426 and this.coner == 3)
- {
- if(this._x <= -44)
- {
- this.coner = 4;
- this._x = -44;
- postCake(this.num);
- }
- else
- {
- this._x -= cakesp;
- }
- }
- if(this.hitTest(_root.m2.area))
- {
- this.cake.deco1.gotoAndStop(2);
- stepArr[this.num][1] = 1;
- trace("making-step2-success/" + stepArr[this.num][1]);
- }
- if(this.hitTest(_root.m3.area) and this.cake.deco1._currentframe == 2 and _root.mm3 == true)
- {
- this.cake.deco1.gotoAndStop(_root.m3num + 2);
- if(_root.m3num == cakeArr[this.num])
- {
- stepArr[this.num][2] = 1;
- trace("making-step3-success");
- }
- else
- {
- stepArr[this.num][2] = 0;
- trace("making-step3-fail");
- }
- }
- if(this.hitTest(_root.m4.area) and this.cake.deco1._currentframe >= 2 and _root.mm4 == true)
- {
- if(_root.m4num == cakeArr[this.num])
- {
- stepArr[this.num][3] = 1;
- trace("making-step4-success");
- }
- else
- {
- stepArr[this.num][3] = 0;
- trace("making-step4-fail");
- }
- this.cake.deco2._visible = true;
- this.cake.deco2.gotoAndStop(_root.m4num);
- this.cake.deco2.ck.gotoAndPlay(1);
- }
- if(this.hitTest(_root.m5.area) and this.cake.deco1._currentframe >= 2 and _root.mm5 == true)
- {
- if(_root.m5num == cakeArr[this.num])
- {
- stepArr[this.num][4] = 1;
- trace("making-step5-success");
- }
- else
- {
- stepArr[this.num][4] = 0;
- trace("making-step5-fail");
- }
- this.cake.deco3._visible = true;
- this.cake.deco3.gotoAndStop(_root.m5num);
- }
- };
- trace("copy : " + copynum);
- copynum++;
- }
- else if(ccnt == _root.itemnum)
- {
- gameover();
- }
- }
- function postCake(num)
- {
- delete _root.cakeMc["cake" + num].onEnterFrame;
- cakeCheck(num);
- }
- function cakeListing()
- {
- var _loc1_ = 0;
- while(_loc1_ < 50)
- {
- pt.cakeList.removeMovieClip();
- _loc1_ = _loc1_ + 1;
- }
- _loc1_ = 0;
- while(_loc1_ < 50)
- {
- pt.cakeList.attachMovie("cg","cg" + _loc1_,_loc1_);
- var _loc2_ = random(4) + 1;
- cakeArr[_loc1_] = _loc2_;
- pt.cakeList["cg" + _loc1_].gotoAndStop(_loc2_);
- pt.cakeList["cg" + _loc1_]._x = _loc1_ * 80 + 10;
- pt.cakeList["cg" + _loc1_].tx = _loc1_ * 80 + 10 - gcnt * 80;
- _loc1_ = _loc1_ + 1;
- }
- trace(cakeArr);
- }
- function cakeListMove()
- {
- trace("이동 : " + gcnt);
- gameSound("list");
- var _loc2_ = 0;
- while(_loc2_ < 50)
- {
- pt.cakeList["cg" + _loc2_].tx = _loc2_ * 80 + 10 - gcnt * 80;
- pt.cakeList["cg" + _loc2_].onEnterFrame = function()
- {
- this._x += (this.tx - this._x) * 0.5;
- };
- _loc2_ = _loc2_ + 1;
- }
- delete pt.cakeList["cg" + (gcnt - 1)].onEnterFrame;
- pt.cakeList["cg" + (gcnt - 1)]._visible = false;
- }
- function initSet()
- {
- trace("시작:" + gcnt);
- pt.m_start._visible = true;
- pt.m_start.gotoAndPlay(2);
- if(ccnt == itemnum)
- {
- _root.point = ccnt;
- gameover();
- }
- else
- {
- cakeListMove();
- }
- }
- function cakeCheck(num)
- {
- trace(stepArr[num]);
- var _loc3_ = 0;
- var _loc2_ = 0;
- while(_loc2_ < 5)
- {
- if(stepArr[num][_loc2_] == 1)
- {
- _loc3_ = _loc3_ + 1;
- }
- _loc2_ = _loc2_ + 1;
- }
- if(_loc3_ == 5)
- {
- trace("success - " + cakeArr[gcnt]);
- pt.cake_result.gotoAndStop(cakeArr[gcnt] + 1);
- pt.cakeList["cg" + gcnt]._visible = false;
- ccnt++;
- pt.cakenum.gotoAndStop(ccnt + 1);
- _root.cakeMc["cake" + num]._visible = false;
- gameSound("success");
- }
- else
- {
- trace("failure - " + _loc3_);
- _root.cakeMc["cake" + num].gotoAndPlay("fail");
- gameSound("failure");
- }
- if(ccnt == itemnum)
- {
- _root.point = ccnt;
- _root.game_overstate = true;
- }
- gcnt++;
- cakeListMove();
- }
- function boxfunc(num)
- {
- cakeColor[ccnt - 1] = 1;
- cakeColor2[ccnt - 1] = num;
- pt.box["b" + ccnt]._visible = true;
- pt.box["b" + ccnt].gotoAndStop(num);
- trace("box - " + ccnt + "/" + cakeColor[ccnt - 1] + "/" + cakeColor2[ccnt - 1]);
- }
- function gameSound(nme)
- {
- switch(nme)
- {
- case "list":
- startSound = new Sound();
- startSound.attachSound("snd_list");
- startSound.setVolume(100);
- startSound.start();
- break;
- case "clock":
- var _loc1_ = new Sound();
- _loc1_.attachSound("clock");
- _loc1_.setVolume(100);
- _loc1_.start(0,10);
- break;
- case "success":
- startSound = new Sound();
- startSound.attachSound("snd_success");
- startSound.setVolume(100);
- startSound.start();
- break;
- case "failure":
- startSound = new Sound();
- startSound.attachSound("snd_failure");
- startSound.setVolume(100);
- startSound.start();
- break;
- case "bgm":
- startSound = new Sound();
- startSound.attachSound("bgm");
- startSound.setVolume(100);
- startSound.start(0,999);
- }
- }
- function gameover()
- {
- trace("cristal number : " + ccnt);
- _root.point = ccnt;
- pt.gotoAndPlay("over");
- }
- function getXmlData()
- {
- trace("-----------------------------------------------");
- trace("게임을 위한 초기 xml 로드");
- trace("-----------------------------------------------");
- var _loc2_ = undefined;
- var _loc3_ = undefined;
- var _loc4_ = xmldoc.firstChild.firstChild;
- while(_loc4_ != null)
- {
- _loc2_ = _loc4_.nodeName;
- _loc3_ = _loc4_.firstChild.nodeValue;
- if(_loc2_ == "allowDomain")
- {
- allowDomain = _loc3_;
- trace("domain:" + allowDomain);
- }
- else if(_loc2_ == "configfile")
- {
- _root.configfile = _loc3_;
- trace("configfile:" + _root.configfile);
- }
- else if(_loc2_ == "updatefile")
- {
- _root.updatefile = _loc3_;
- trace("updatefile:" + _root.updatefile);
- }
- else if(_loc2_ == "loginfile")
- {
- _root.loginfile = _loc3_;
- trace("loginfile:" + _root.loginfile);
- }
- else if(_loc2_ == "cristal")
- {
- cristal = _loc3_;
- trace("cirstal:" + cristal);
- }
- else if(_loc2_ == "popmsg")
- {
- popmsg = _loc3_;
- trace("popmsg:" + popmsg);
- }
- _loc4_ = _loc4_.nextSibling;
- }
- _root.cristalpoint = cristal.split(",");
- _root.popmessage = popmsg.split(",");
- trace("-----------------------------------------------");
- }
- function dbCon(filename)
- {
- dbs = new LoadVars();
- dbs.onLoad = function(success)
- {
- pt.loginstate = dbs.loginstate;
- if(success)
- {
- trace("database connect success!! - " + pt.loginstate);
- if(pt.loginstate != "Y")
- {
- getURL(loginfile,"");
- }
- }
- else
- {
- trace("database connect failure!!");
- getURL(loginfile,"");
- }
- };
- randoms = Math.random();
- dbs.load(filename + "?rnd=" + randoms + "&gameid=" + _root.gameid);
- }
- function cristalvalue(point)
- {
- var _loc3_ = _root.cristalpoint.length;
- var _loc2_ = 0;
- while(_loc2_ < _loc3_)
- {
- if(_loc2_ <= _loc3_ - 2)
- {
- if(point > int(_root.cristalpoint[_loc2_]) and point <= int(_root.cristalpoint[_loc2_ + 1]))
- {
- cristalnum = _loc2_;
- break;
- }
- }
- else if(_loc2_ == _loc3_ - 1)
- {
- if(point > int(_root.cristalpoint[_loc2_]))
- {
- cristalnum = _loc2_;
- break;
- }
- }
- _loc2_ = _loc2_ + 1;
- }
- cristalmessage(cristalnum);
- _root.msgnum = cristalnum;
- }
- function cristalmessage(cnum)
- {
- var _loc2_ = _root.popmessage[0] + cnum + _root.popmessage[1];
- getURL("FSCommand:cristalmsg",_loc2_);
- trace(_loc2_ + "/" + cnum);
- }
- var pt = _root;
- var cakeArr = [];
- var stepArr = [];
- var cakeColor = [];
- var cakeColor2 = [];
- var initCX = pt.cakeList._x;
- var game_overstate = false;
- stopAllSounds();
- var gcnt = 0;
- var ccnt = 0;
- var itemnum = 10;
- var initTime = 150;
- _root.point = 0;
- var cakesp = 2.8;
- var caketime = 9500;
- var copynum = 0;
- _root.m3num = 0;
- _root.m4num = 0;
- _root.m5num = 0;
- gameStart();
- cakeStart();
- timeSpace = 0;
- _root.ts = getTimer();
- _root.timmer.onEnterFrame = function()
- {
- var _loc3_ = (getTimer() - _root.ts) / 1000;
- timeSec = initTime - Math.floor(_loc3_) + 1 + timeSpace;
- if(timeSec == 0)
- {
- gameover();
- }
- this.gotoAndStop(timeSec);
- };
- gameSound("bgm");
- System.useCodepage = true;
- if(_root.xmldir == undefined)
- {
- _root.xmldir = "../";
- }
- xmldoc = new XML();
- xmldoc.ignoreWhite = true;
- xmldoc.load(_root.xmldir + "cake.xml");
- xmldoc.onLoad = getXmlData;
- System.security.allowDomain("*");
-